﻿using System.Windows;
using System.Windows.Controls;

namespace Revit同步插件.UI
{
  /// <summary>
  /// UserControl1.xaml 的交互逻辑
  /// </summary>
  public partial class TreeTestWin : Window
  {
    public TreeTestWin()
    {
      InitializeComponent();
      Mock();
      this.umlTree.PreEditDelegate += UmlTree_PreEditDelegate; ;
    }

    private void UmlTree_PreEditDelegate(object obj, ShitLibrary.CEventArgs e)
    {
      StartupForm frm = new StartupForm();
      frm.ShowDialog();
      var ti = e.DataSource as TreeViewItem;
      if (ti != null)
      {
        ti.Header = "xxxxx";
      }

    }

    void Mock()
    {
      TreeViewItem[] list = new TreeViewItem[5];
      for(int i = 0;i < 5; i++)
      {
        TreeViewItem iroot = new TreeViewItem();

        iroot.Header = i;
        iroot.Tag = i;
        for(int j = 1; j < 3; j++)
        {
          TreeViewItem leaf = new TreeViewItem();
          leaf.Header = j;
          leaf.Tag = j;
          iroot.Items.Add(leaf);
        }
        this.umlTree.Items.Add(iroot);
      }
  
    
    }

  }
}
